//
//  BannerPageControl.m
//  Xspcf
//
//  Created by 赵欢 on 2018/4/12.
//  Copyright © 2018年 小小算盘. All rights reserved.
//

#import "BannerPageControl.h"

@implementation BannerPageControl
#define dotW X(15)
#define magrin 5
- (void)layoutSubviews
{
    [super layoutSubviews];
    [self changePageControlSize];
}
- (void) changePageControlSize {
    NSInteger marginX = dotW + magrin;
    for (NSUInteger subviewIndex = 0; subviewIndex < [self.subviews count]; subviewIndex++) {
        
        UIImageView* subview = [self.subviews objectAtIndex:subviewIndex];
        
        [subview setFrame:CGRectMake(subviewIndex * marginX, subview.frame.origin.y, X(15), X(4))];
        subview.layer.cornerRadius = 2;
        subview.layer.masksToBounds = YES;
    }
}
-(void)setCurrentPage:(NSInteger)currentPage{
    [super setCurrentPage:currentPage];
    [self changePageControlSize];
}
@end
